package com.scu.service;

import com.scu.dao.AdminDao;
import com.scu.dao.NoticeDao;
import com.scu.pojo.Notice;
import com.scu.pojo.PageInfo;
import com.scu.pojo.PageInfo;
import com.scu.pojo.User;
import com.scu.pojo.UserRank;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.xml.ws.Action;
import java.util.List;


@Service
@Transactional
public class AdminServiceImpl implements AdminService {
    @Autowired
    private AdminDao adminDao;

    @Override
    public List<User> getAllUser(PageInfo info) {
        return adminDao.getAllUser((info.getPage()-1)*info.getLimit(), info.getLimit());
    }

    @Override
    public List<UserRank> getUserRank() {
        return adminDao.getUserRank();
    }

    @Override
    public List<User> getNewUser() {
        return adminDao.getNewUser();
    }

    @Override
    public int changeUserType(int u_id) {
        return adminDao.changeUserType(u_id);
    }

    @Override
    public int deleteUser(int u_id) {
        return adminDao.deleteUser(u_id);
    }

    @Override
    public int banUser(int u_id) {
        return adminDao.banUser(u_id);
    }

    @Override
    public int getUserNum() {
        return adminDao.getUserNum();
    }
}
